package leecode

func arrayChange(nums []int, operations [][]int) []int {
	hashMap := make(map[int]int)
	for index, num := range nums {
		hashMap[num] = index
	}
	for i := 0; i < len(operations); i++ {
		nums[hashMap[operations[i][0]]] = operations[i][1]
		hashMap[operations[i][1]] = hashMap[operations[i][0]]
	}
	return nums
}
